<!-- 招募 -->
<template>
  <div class="app-container">
    <!-- 检索 -->
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
    >
      <el-form-item label="名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入名称"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
        >
          搜索
        </el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
          重置
        </el-button>
      </el-form-item>
    </el-form>

    <!-- 表格 -->
    <el-table v-loading="loading" :data="tableList">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="名称" prop="name" align="center" />
      <el-table-column label="联系人" prop="contact" align="center" />
      <el-table-column label="联系电话" prop="phone" align="center" />
      <el-table-column label="邮箱" prop="mail" align="center" />
      <el-table-column label="类别" prop="type" align="center">
        <template slot-scope="scope">
          <el-tag>{{ scope.row.type == 1 ? "门店" : "工作室" }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="所在城市" prop="city" align="center" />
      <el-table-column label="申请日期" prop="createTime" align="center" />
      <el-table-column label="申请理由" prop="remark" align="center" />
    </el-table>

    <!-- 分页 -->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script>
import { customerRecruitList } from "@/api/useMenu/recruit";
export default {
  name: "Recruit",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      tableList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: undefined,
      },
    };
  },
  created() {
    this.getList();
  },
  mounted() {},
  methods: {
    /** 查询表格数据 */
    async getList() {
      this.loading = true;
      let response = await customerRecruitList(this.queryParams);
      this.tableList = response.rows;
      this.total = response.total;
      this.loading = false;
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>
<style lang="scss" scoped></style>
